//
//  MyViewController.m
//  DanTang
//
//  Created by honeyrr on 2017/9/4.
//  Copyright © 2017年 honeyrr. All rights reserved.
//

#import "MyViewController.h"
#import "MyHeaderView.h"
#import "MyMessageViewController.h"

@interface MyViewController ()<UITableViewDelegate, UITableViewDataSource, MyHeaderViewDelegate>

@property(nonatomic, strong) UITableView *myTableView;

@property(nonatomic, strong) MyHeaderView *headerView;

@end

@implementation MyViewController

-(void)viewWillAppear:(BOOL)animated
{
    self.view.backgroundColor = [UIColor whiteColor];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpUI];
    
}

-(void) setUpUI
{
    [self.view addSubview:self.myTableView];
}

-(MyHeaderView *)headerView
{
    if (!_headerView) {
        MyHeaderView *headerView = [[MyHeaderView alloc]initWithFrame:CGRectMake(0, 0, DTScreenW, 200)];
        headerView = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([MyHeaderView class]) owner:nil options:nil] lastObject];
        headerView.delegate = self;
        _headerView = headerView;
    }
    return _headerView;
}
-(void)headerViewMsgBtnClick:(MyHeaderView *)headerView
{
    [self.navigationController pushViewController:[MyMessageViewController new] animated:YES];
}
-(void)headerViewIconBtnClick:(MyHeaderView *)headerView
{
    
}

-(UITableView *)myTableView
{
    if (!_myTableView) {
        UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, -20, DTScreenW, DTScreenH) style:UITableViewStylePlain];
        tableView.delegate = self;
        tableView.dataSource = self;
        tableView.tableHeaderView = self.headerView;
        tableView.tableFooterView = [UIView new];
        _myTableView = tableView;
    }
    return _myTableView;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 0;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell;
    return cell;
}


@end
